/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gr.uop.cst.context.adaptation.aspectj;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;

/**
 *
 * @author jbourlakos
 */
class AspectJAdaptationCodePrinter {
    
    public static final String FILE_PREFIX = "context_";
    public static final String FILE_SUFFIX = ".aj";
    
    
    private String filename;
    private PrintStream output;
    
    public AspectJAdaptationCodePrinter(File f) throws FileNotFoundException {
        this.filename = f.getAbsolutePath();
        this.output = new PrintStream(this.filename);
    }
    
    public AspectJAdaptationCodePrinter(String filename) throws FileNotFoundException {
        this(new File(filename));
    }
    
    public AspectJAdaptationCodePrinter() throws IOException {
        this(File.createTempFile(FILE_PREFIX, FILE_SUFFIX));
    }
    
    void write(String s) {
        output.print(s);
    }
    
    public void close() {
        this.output.close();
    }
    
    public String getFilename() {
        return this.filename;
    }
    
    
}
